﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Acms.AcmsControls.ContentControls.Admin
{
    public class TextAdminDisplay : BaseAdminDisplay<TextContentControlProperties>
    {
        protected override string GetCssClass
        {
            get { return "text"; }
        }

        public override void PropertiesLoaded(TextContentControlProperties properties)
        {
            base.PropertiesLoaded(properties);
            if (Properties != null)
            {
                Text = properties.Text;
            }
        }

        public string Text { get; set; }

        protected override object SaveViewState()
        {
            ViewState["Text"] = Text;
            return base.SaveViewState();
        }

        protected override void LoadViewState(object savedState)
        {
            base.LoadViewState(savedState);
            Text = ViewState["Text"] as string;
        }

        protected override void RenderContents(System.Web.UI.HtmlTextWriter writer)
        {
            writer.Write(Text);
        }
    }
}
